# -*- coding:utf-8 -*-
"""
Author：Administrator
Date:2022年01月04日
"""
import requests

url = "https://www.pearvideo.com/video_1749173"
contId = url.split('_')[1]

videoStatusUrl = f"https://www.pearvideo.com/videoStatus.jsp?contId={contId}&mrd=0.5582732372530559"
headers = {
'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 "
              "Safari/537.36",
	# 防盗链,溯源
'Referer':url
}
resp = requests.get(videoStatusUrl, headers=headers)
dict=resp.json()
srcUrl = dict["videoInfo"]["videos"]["srcUrl"]
systemTime = dict['systemTime']
srcUrl = srcUrl.replace(systemTime,f"cont-{contId}")

# 下载视频
with open('a.mp4',mode='wb') as f :
	f.write(requests.get(srcUrl).content)
